#include "./../Include/public.h"
void del_course()
{
	printf("输入要删除课程的课程号：\n");
	int cno;
	scanf("%d",&cno);
	
	FILE *f;
 	f = fopen("./data/log.log", "a+");
       time_t now ;
       struct tm *tm_now ;
       time(&now) ;
       tm_now = localtime(&now) ;
  		fprintf(f,"datetime: %d-%d-%d %d:%d:%d\n",tm_now->tm_year+1900, tm_now->tm_mon+1, tm_now->tm_mday, tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec) ;
  	fprintf(f, "delete course: %d\n",cno);
  	fclose(f);
	
	struct course* p = head_course;
	struct course* q = p;
	while (p != NULL) {
		if (p->cno == cno) {
			if(p == head_course) head_course = head_course->next;
			else	q->next = p->next;
			return;	
		}
		q = p;
		p = p->next;
	}
	printf("该课程不存在!\n");
}
